<?php
    require_once ("Includes/session.php");
    require_once ("Includes/simplecms-config.php"); 
    require_once ("Includes/connectDB.php");
    require_once("conf.php");   
    include("Includes/header.php"); 
    if (!logged_on())
    {
        header ("Location: logon.php");
    }

?>

        <div id="fullmain">
            <h2>Exam History</h2>
            <p>Double click a record to view more info</p>    
            <?php
            $dg = new C_DataGrid("SELECT exam_attempts.id AS at_id , user_id , exam_id , ready , anstime , mark , title   FROM exam_attempts INNER JOIN exams on exam_attempts.exam_id = exams.id", "at_id", "exam_attempts");
            $dg -> set_query_filter("user_id = ".$_SESSION['userid']);
            $dg -> set_dimension(400, 500); 
            $dg -> set_col_hidden("at_id");
            $dg -> set_col_hidden("user_id");
            $dg -> set_col_hidden("exam_id");
            
            $dg -> set_col_hidden("ready");
            $dg -> set_col_title("title", "Exam");
            $dg -> set_col_title("anstime", "Date");
            
            $dg -> set_col_title("mark", "Score");
            $dg -> enable_export('PDF');
            $dg -> enable_export('EXCEL');
            $dg -> enable_search(true);
            $dg -> enable_advanced_search(true);
            $onSelectRow = <<<ONSELECTROW
            function(status, rowid)
            {
                window.location = "StudentExamReport.php?id=" + rowid;
	            //alert(rowid);
            }
ONSELECTROW;


                //$dg->add_event("jqGridSelectRow", $onSelectRow);
                $dg -> add_event("jqGridDblClickRow", $onSelectRow);
                $dg -> display();
            ?>
        </div>
</div>

<?php include ("Includes/footer.php"); ?>